<?php

use think\migration\Migrator;
use app\model\Template;

class AlterTemplateModifly extends Migrator
{
    public function up()
    {
        $template = Template::where('template_name', '聚合模板')->find();
        //$domain = request()->domain();
        $domain = env('app.api_url');
        if ($template) {
            $template->template_name = '本地生活';
            $template->template_img  = $domain.'/template/local_life.png';
            $template->save();
        }
    }

    public function down()
    {
        $template = Template::where('template_name', '本地生活')->find();
        //$domain = request()->domain();
        $domain = env('app.api_url');
        if ($template) {
            $template->template_name = '聚合模板';
            $template->template_img  = $domain.'/template/union.jpg';
            $template->save();
        }
    }
}
